"use strict";
/**
 * 类型断言
 */
function getValueLength(msg) {
    //msg默认为any类型,无法推断出他有split
    const res = msg.split("");
    //msg是any类型,无法确认length
    return msg.length;
}
const value2 = getValueLength(123);
let someValue = "this is a string";
//告诉编辑器，someValue在使用的时候，一定是string类型。不要默认推断
let strLength = someValue.length;
let strLength2 = someValue.length;
const student = {
    id: 1,
    name: "小五"
};
function getValueByKey(obj, key) {
    return obj["name"];
}
const result = getValueByKey(student, "address");
